// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.

// This code was generated by google-apis-code-generator 1.5.1

// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
//   Cloud Storage JSON API (storage/v1)
// Generated from:
//   Version: v1
//   Revision: 20171004
// Generated by:
//    Tool: google-apis-code-generator 1.5.1
//     C++: 0.1.5
#ifndef  GOOGLE_STORAGE_API_POLICY_H_
#define  GOOGLE_STORAGE_API_POLICY_H_

#include <string>
#include "googleapis/base/macros.h"
#include "googleapis/client/data/jsoncpp_data.h"
#include "googleapis/strings/stringpiece.h"

namespace Json {
class Value;
}  // namespace Json

namespace google_storage_api {
using namespace googleapis;

/**
 * A bucket/object IAM policy.
 *
 * @ingroup DataObject
 */
class Policy : public client::JsonCppData {
 public:
  /**
   * No description provided.
   *
   * @ingroup DataObject
   */
  class PolicyBindings : public client::JsonCppData {
   public:
    /**
     * Creates a new default instance.
     *
     * @return Ownership is passed back to the caller.
     */
    static PolicyBindings* New();

    /**
     * Standard constructor for an immutable data object instance.
     *
     * @param[in] storage  The underlying data storage for this instance.
     */
    explicit PolicyBindings(const Json::Value& storage);

    /**
     * Standard constructor for a mutable data object instance.
     *
     * @param[in] storage  The underlying data storage for this instance.
     */
    explicit PolicyBindings(Json::Value* storage);

    /**
     * Standard destructor.
     */
    virtual ~PolicyBindings();

    /**
     * Returns a string denoting the type of this data object.
     *
     * @return <code>google_storage_api::PolicyBindings</code>
     */
    const char* GetTypeName() const {
      return "google_storage_api::PolicyBindings";
    }

    /**
     * Determine if the '<code>condition</code>' attribute was set.
     *
     * @return true if the '<code>condition</code>' attribute was set.
     */
    bool has_condition() const {
      return Storage().isMember("condition");
    }

    /**
     * Clears the '<code>condition</code>' attribute.
     */
    void clear_condition() {
      MutableStorage()->removeMember("condition");
    }


    /**
     * Get a reference to the value of the '<code>condition</code>' attribute.
     */
    const client::JsonCppData get_condition() const {
       const Json::Value& storage = Storage("condition");
      return client::JsonValueToCppValueHelper<client::JsonCppData >(storage);
    }

    /**
     * Gets a reference to a mutable value of the '<code>condition</code>'
     * property.
     * @return The result can be modified to change the attribute value.
     */
    client::JsonCppData mutable_condition() {
      Json::Value* storage = MutableStorage("condition");
      return client::JsonValueToMutableCppValueHelper<client::JsonCppData >(storage);
    }

    /**
     * Determine if the '<code>members</code>' attribute was set.
     *
     * @return true if the '<code>members</code>' attribute was set.
     */
    bool has_members() const {
      return Storage().isMember("members");
    }

    /**
     * Clears the '<code>members</code>' attribute.
     */
    void clear_members() {
      MutableStorage()->removeMember("members");
    }


    /**
     * Get a reference to the value of the '<code>members</code>' attribute.
     */
    const client::JsonCppArray<string > get_members() const {
       const Json::Value& storage = Storage("members");
      return client::JsonValueToCppValueHelper<client::JsonCppArray<string > >(storage);
    }

    /**
     * Gets a reference to a mutable value of the '<code>members</code>'
     * property.
     *
     * A collection of identifiers for members who may assume the provided role.
     * Recognized identifiers are as follows:
     * - allUsers — A special identifier that represents anyone on the internet;
     * with or without a Google account.
     * - allAuthenticatedUsers — A special identifier that represents anyone who
     * is authenticated with a Google account or a service account.
     * <dl>
     * <dt>user
     * <dd>emailid — An email address that represents a specific account. For
     * example, user:alice@gmail.com or user:joe@example.com.
     * <dt>serviceAccount
     * <dd>emailid — An email address that represents a service account. For
     * example,  serviceAccount:my-other-app@appspot.gserviceaccount.com .
     * <dt>group
     * <dd>emailid — An email address that represents a Google group. For
     * example, group:admins@example.com.
     * <dt>domain
     * <dd>domain — A Google Apps domain name that represents all the users of
     * that domain. For example, domain:google.com or domain:example.com.
     * <dt>projectOwner
     * <dd>projectid — Owners of the given project. For example, projectOwner
     * :my-example-project.
     * <dt>projectEditor
     * <dd>projectid — Editors of the given project. For example, projectEditor
     * :my-example-project.
     * <dt>projectViewer
     * <dd>projectid — Viewers of the given project. For example, projectViewer
     * :my-example-project.
     * </dl>
     *
     *
     * @return The result can be modified to change the attribute value.
     */
    client::JsonCppArray<string > mutable_members() {
      Json::Value* storage = MutableStorage("members");
      return client::JsonValueToMutableCppValueHelper<client::JsonCppArray<string > >(storage);
    }

    /**
     * Determine if the '<code>role</code>' attribute was set.
     *
     * @return true if the '<code>role</code>' attribute was set.
     */
    bool has_role() const {
      return Storage().isMember("role");
    }

    /**
     * Clears the '<code>role</code>' attribute.
     */
    void clear_role() {
      MutableStorage()->removeMember("role");
    }


    /**
     * Get the value of the '<code>role</code>' attribute.
     */
    const StringPiece get_role() const {
      const Json::Value& v = Storage("role");
      if (v == Json::Value::null) return StringPiece("");
      return StringPiece(v.asCString());
    }

    /**
     * Change the '<code>role</code>' attribute.
     *
     * The role to which members belong. Two types of roles are supported: new
     * IAM roles, which grant permissions that do not map directly to those
     * provided by ACLs, and legacy IAM roles, which do map directly to ACL
     * permissions. All roles are of the format roles/storage.specificRole.
     * The new IAM roles are:
     * - roles/storage.admin — Full control of Google Cloud Storage resources.
     * - roles/storage.objectViewer — Read-Only access to Google Cloud Storage
     * objects.
     * - roles/storage.objectCreator — Access to create objects in Google Cloud
     * Storage.
     * - roles/storage.objectAdmin — Full control of Google Cloud Storage
     * objects.   The legacy IAM roles are:
     * - roles/storage.legacyObjectReader — Read-only access to objects without
     * listing. Equivalent to an ACL entry on an object with the READER role.
     * - roles/storage.legacyObjectOwner — Read/write access to existing objects
     * without listing. Equivalent to an ACL entry on an object with the OWNER
     * role.
     * - roles/storage.legacyBucketReader — Read access to buckets with object
     * listing. Equivalent to an ACL entry on a bucket with the READER role.
     * - roles/storage.legacyBucketWriter — Read access to buckets with object
     * listing/creation/deletion. Equivalent to an ACL entry on a bucket with
     * the WRITER role.
     * - roles/storage.legacyBucketOwner — Read and write access to existing
     * buckets with object listing/creation/deletion. Equivalent to an ACL entry
     * on a bucket with the OWNER role.
     *
     * @param[in] value The new value.
     */
    void set_role(const StringPiece& value) {
      *MutableStorage("role") = value.data();
    }

   private:
    void operator=(const PolicyBindings&);
  };  // PolicyBindings
  /**
   * Creates a new default instance.
   *
   * @return Ownership is passed back to the caller.
   */
  static Policy* New();

  /**
   * Standard constructor for an immutable data object instance.
   *
   * @param[in] storage  The underlying data storage for this instance.
   */
  explicit Policy(const Json::Value& storage);

  /**
   * Standard constructor for a mutable data object instance.
   *
   * @param[in] storage  The underlying data storage for this instance.
   */
  explicit Policy(Json::Value* storage);

  /**
   * Standard destructor.
   */
  virtual ~Policy();

  /**
   * Returns a string denoting the type of this data object.
   *
   * @return <code>google_storage_api::Policy</code>
   */
  const char* GetTypeName() const {
    return "google_storage_api::Policy";
  }

  /**
   * Determine if the '<code>bindings</code>' attribute was set.
   *
   * @return true if the '<code>bindings</code>' attribute was set.
   */
  bool has_bindings() const {
    return Storage().isMember("bindings");
  }

  /**
   * Clears the '<code>bindings</code>' attribute.
   */
  void clear_bindings() {
    MutableStorage()->removeMember("bindings");
  }


  /**
   * Get a reference to the value of the '<code>bindings</code>' attribute.
   */
  const client::JsonCppArray<PolicyBindings > get_bindings() const {
     const Json::Value& storage = Storage("bindings");
    return client::JsonValueToCppValueHelper<client::JsonCppArray<PolicyBindings > >(storage);
  }

  /**
   * Gets a reference to a mutable value of the '<code>bindings</code>'
   * property.
   *
   * An association between a role, which comes with a set of permissions, and
   * members who may assume that role.
   *
   * @return The result can be modified to change the attribute value.
   */
  client::JsonCppArray<PolicyBindings > mutable_bindings() {
    Json::Value* storage = MutableStorage("bindings");
    return client::JsonValueToMutableCppValueHelper<client::JsonCppArray<PolicyBindings > >(storage);
  }

  /**
   * Determine if the '<code>etag</code>' attribute was set.
   *
   * @return true if the '<code>etag</code>' attribute was set.
   */
  bool has_etag() const {
    return Storage().isMember("etag");
  }

  /**
   * Clears the '<code>etag</code>' attribute.
   */
  void clear_etag() {
    MutableStorage()->removeMember("etag");
  }


  /**
   * Get the value of the '<code>etag</code>' attribute.
   */
  const StringPiece get_etag() const {
    const Json::Value& v = Storage("etag");
    if (v == Json::Value::null) return StringPiece("");
    return StringPiece(v.asCString());
  }

  /**
   * Change the '<code>etag</code>' attribute.
   *
   * HTTP 1.1  Entity tag for the policy.
   *
   * @param[in] value The new value.
   */
  void set_etag(const StringPiece& value) {
    *MutableStorage("etag") = value.data();
  }

  /**
   * Determine if the '<code>kind</code>' attribute was set.
   *
   * @return true if the '<code>kind</code>' attribute was set.
   */
  bool has_kind() const {
    return Storage().isMember("kind");
  }

  /**
   * Clears the '<code>kind</code>' attribute.
   */
  void clear_kind() {
    MutableStorage()->removeMember("kind");
  }


  /**
   * Get the value of the '<code>kind</code>' attribute.
   */
  const StringPiece get_kind() const {
    const Json::Value& v = Storage("kind");
    if (v == Json::Value::null) return StringPiece("");
    return StringPiece(v.asCString());
  }

  /**
   * Change the '<code>kind</code>' attribute.
   *
   * The kind of item this is. For policies, this is always storage#policy. This
   * field is ignored on input.
   *
   * @param[in] value The new value.
   */
  void set_kind(const StringPiece& value) {
    *MutableStorage("kind") = value.data();
  }

  /**
   * Determine if the '<code>resourceId</code>' attribute was set.
   *
   * @return true if the '<code>resourceId</code>' attribute was set.
   */
  bool has_resource_id() const {
    return Storage().isMember("resourceId");
  }

  /**
   * Clears the '<code>resourceId</code>' attribute.
   */
  void clear_resource_id() {
    MutableStorage()->removeMember("resourceId");
  }


  /**
   * Get the value of the '<code>resourceId</code>' attribute.
   */
  const StringPiece get_resource_id() const {
    const Json::Value& v = Storage("resourceId");
    if (v == Json::Value::null) return StringPiece("");
    return StringPiece(v.asCString());
  }

  /**
   * Change the '<code>resourceId</code>' attribute.
   *
   * The ID of the resource to which this policy belongs. Will be of the form
   * projects/_/buckets/bucket for buckets, and
   * projects/_/buckets/bucket/objects/object for objects. A specific generation
   * may be specified by appending #generationNumber to the end of the object
   * name, e.g. projects/_/buckets/my-bucket/objects/data.txt#17. The current
   * generation can be denoted with #0. This field is ignored on input.
   *
   * @param[in] value The new value.
   */
  void set_resource_id(const StringPiece& value) {
    *MutableStorage("resourceId") = value.data();
  }

 private:
  void operator=(const Policy&);
};  // Policy
}  // namespace google_storage_api
#endif  // GOOGLE_STORAGE_API_POLICY_H_
